﻿using System.Data.Entity.ModelConfiguration;
using ZSoftInstagram.Domain;

namespace ZSoftInstagram.DataAccess.Config
{
    public class CategoryConfig: EntityTypeConfiguration<Category>
    {
        public CategoryConfig()
        {
            this.HasKey(c => c.Id);

            this.HasMany(c => c.FollowingUsers)
                    .WithMany(u => u.FollowingCategories)
                    .Map(u => u.MapLeftKey("CategoryId").MapRightKey("UserId").ToTable("CategoryUser"));
        }
    }
}
